Utility for Reading 2 Dimensional Integer Arrays, U2DINT

©1995,1996 Richard B. Winston

Please Register Please Register

Last modified on Wednesday, January 31, 1996 - 7:19:57 PM

Skip forward to Input instructions for the U2DINT Utility.

The original instructions for U2DINT are on pages 14-4 to 14-5 of McDonald and Harbaugh (1988).

Introduction: U2DINT is a utility module that is used to enter two dimensional arrays of integers.

Go back to Contents


Input instructions

All input parameters (except FMTIN) should be right justified


Line 1; Spaces 1-10; Variable = LOCAT

LOCAT does two things; it tells where to find the data that is in the 1 dimensional array and it tells whether the data is formatted or not. Normally the data is formatted. You might want to use unformatted data if you were using the output of a previous model run as the initial conditions for another model. LOCAT should be right-justified. Most of the time, you would set LOCAT > 0. If LOCAT < > 0, the value that you specify for LOCAT is the "unit number". That is, it is the number assigned to the file which has the data. You probably assigned the unit number in line 4 of the Basic Package. If you specify a unit number which you have not assigned previously, the program should prompt you for the file name during program execution. LOCAT is in integer so you should not use a decimal point.

Go back to Input instructions for the U2DINT option.
Go to top of U2DINT section..


Line 1; Spaces 11-20; Variable = ICNSTNT


The meaning of ICNSTNT depends on the value of LOCAT. ICNSTNT should be right justified. ICNSTNT is in integer so you should not use a decimal point.

Go back to Input instructions for the U2DINT option.
Go to top of U2DINT section.


Line 1; Spaces 21-40; Variable = FMTIN


This gives the FORTRAN format for the values in the array that will be read. FMTIN is only used if LOCAT > 0. Otherwise the spaces reserved for FMTIN should be left blank. The format must be enclosed in parentheses. FMTIN need not be right justified.

Go back to Input instructions for the U2DINT option.
Go to top of U2DINT section.


Line 1; Spaces 41-50; Variable = IPRN

IPRN indicates that the array should be printed with a specific FORTRAN format. U2DINT gives you fewer format choices than U2DREL. IPRN is in integer so you should not use a decimal point.

If IPRN < 0, the array will not be printed
If IPRN = 0, the format will be 10I11
If IPRN = 1, the format will be 60I1
If IPRN = 2, the format will be 40I2
If IPRN = 3, the format will be 30I3
If IPRN = 4, the format will be 25I4
If IPRN = 5, the format will be 20I5

Go back to Input instructions for the U2DINT option.
Go to top of U2DINT section.


The Array itself

On the following lines you enter the values that go in the array if those values aren't supposed to be in some other file. Be sure that the data are in the format you specified in FMTIN. It's OK if a line ends early so long as there are no blank spaces at the end of the line. If there are blank spaces, those may be interpreted as 0's.

Go back to Input instructions for the U2DINT option.
Go to top of U2DINT section.


Example

Let's suppose you are trying to enter the following 1 dimensional array

0 1 1 0 1 1 1 0 0 0 1 1 0 1 0

The first two lines below show positions on the line in the examples which follow. Those two lines do not go into the input file. We will suppose that we are reading the array on unit 10. We could enter the data as follows:

00000000011111111112222222222333333333344444444445
12345678901234567890123456789012345678901234567890

bbbbbbbb10bbbbbbbbb1bbbbbb(40I2)bbbbbbbbbbbbbbbbb3
b0b1b1b0b1b1b1b0b0b0b1b1b0b1b0

As always, I'm using

b
to indicate blank spaces.

The first line of this example says that the array should be read from unit 10 (LOCAT) and then multiplied by 1 (ICNSTNT). In the input file, the values in the array are in the 40I2 format (FMTIN) and they will be printed in the 30I3 format (IPRN) after being multiplied by 1 (ICNSTNT). The final printed values in the output as specified by IPRN and the numbers used in subsequent calculations will be:

000000000111111111122222222223333333333444444444455555555556666666666777
123456789012345678901234567890123456789012345678901234567890123456789012

bb0bb1bb1bb0bb1bb1bb1bb0bb0bb0bb1bb1bb0bb1bb0

Please note that you are not required to use all 20 places on a line in the input file before starting a new line.

If you are confused, you may wish to review FORTRAN formats.

Go back to Input instructions for the U2DINT option.
Go to top of U2DINT section.

Go back to Contents



©1995,1996 Richard B. Winston,
rwinsto@lsuvm.sncc.lsu.edu
Dept. of Geology and Geophysics
Louisiana State University
Baton Rouge, La 70803
U.S.A.
504-388-2337
Fax 504-388-2302
http://scribe.geol.lsu.edu/rbwinston.html
ftp://aapg.geol.lsu.edu/pub/winston